﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using NLog;

namespace NGinnBPM.Engine.WindsorHost
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        private Logger log = LogManager.GetCurrentClassLogger();

        public ProjectInstaller()
        {
            this.BeforeInstall += new InstallEventHandler(ProjectInstaller_BeforeInstall);
            InitializeComponent();
        }

        void ProjectInstaller_BeforeInstall(object sender, InstallEventArgs e)
        {
            try
            {
                log.Info("Before install");
                if (Context.Parameters["servicename"] != null)
                {
                    this.serviceInstaller1.ServiceName = Context.Parameters["servicename"];
                }
                log.Info("Service name: {0}", this.serviceInstaller1.ServiceName);
            }
            catch (Exception ex)
            {
                log.Error("BeforeInstall error: {0}", ex);
                throw;
            }
        }

        
    }

}
